package cn.pms.po;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * WorkTime entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "t_worktime", schema = "SCOTT")
public class WorkTime implements java.io.Serializable
{
	private static final long serialVersionUID = 8098008504976924542L;
	// Fields
	private Integer id;
	private Integer startTime;
	private Integer endTime;
	private Set<Date> dates = new HashSet<Date>(0);
	
	// Constructors
	/** default constructor */
	public WorkTime()
	{}
	
	/** minimal constructor */
	public WorkTime(Integer startTime, Integer endTime)
	{
		this.startTime = startTime;
		this.endTime = endTime;
	}
	
	/** full constructor */
	public WorkTime(Integer startTime, Integer endTime,
			Set<Date> dates)
	{
		this.startTime = startTime;
		this.endTime = endTime;
		this.dates = dates;
	}
	
	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false, precision = 32, scale = 0)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_WORKTIME")
	@SequenceGenerator(name = "SEQ_WORKTIME", sequenceName = "SEQ_WORKTIME", allocationSize = 1)
	public Integer getId()
	{
		return this.id;
	}
	
	public void setId(Integer id)
	{
		this.id = id;
	}
	
	@Column(name = "startTime", nullable = false)
	public Integer getStartTime()
	{
		return this.startTime;
	}
	
	public void setStartTime(Integer startTime)
	{
		this.startTime = startTime;
	}
	
	@Column(name = "endTime", nullable = false)
	public Integer getEndTime()
	{
		return this.endTime;
	}
	
	public void setEndTime(Integer endTime)
	{
		this.endTime = endTime;
	}
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "workTime")
	public Set<Date> getDates()
	{
		return this.dates;
	}
	
	public void setDates(Set<Date> dates)
	{
		this.dates = dates;
	}
}
